home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
sort2.zip
/
ANSTR.FUN
< prev
next >
Wrap
Text File
|
1993-01-04
|
633b
|
21 lines
function anstr(s:string):string;
{ returns a string stripped of non-alphanumerics (changed to ' ')}
{ Copyright 1988, 1989, by J. W. Rider }
var i,j:integer;
{ The original version just blanked out non-alphanumerics }
{ begin for i:=1 to length(s) do
if not (s[i] in ['0'..'9','A'..'Z','a'..'z']) then s[i]:=' ';
anstr:=s; end; }
{ The current version completely eliminates non-alphanumerics from
the string, including blanks and control chars }
begin j:=0;
for i:=1 to length(s) do
if (s[i] in ['0'..'9','A'..'Z','a'..'z']) then begin
inc(j); s[j]:=s[i]; end;
byte(s[0]):=j;
anstr:=s; end;